package com.qk.util;

/**
 * @Author: zhangchuang
 * @Date: 2025/10/15 09:07
 * @Description: 当前用户信息
 */
@SuppressWarnings("all")
public class CurrentUserContextHolders {

    private static final ThreadLocal<Integer> CURRENT_USER_ID = new ThreadLocal<>();
    private static final ThreadLocal<String> CURRENT_USER_NAME = new ThreadLocal<>();

    public static void setId(Integer userId) {
        CURRENT_USER_ID.set(userId);
    }

    public static void setName(String name) {
        CURRENT_USER_NAME.set(name);
    }

    public static Integer getId() {
        return CURRENT_USER_ID.get();
    }

    public static String getName() {
        return CURRENT_USER_NAME.get();
    }

    public static void removeId() {
        CURRENT_USER_ID.remove();
    }

    public static void removeName() {
        CURRENT_USER_NAME.remove();
    }

}
